from PyQt5.QtCore import pyqtSignal
from dash import Dash


class QDashPlotly(QtCore.QObject):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.dash = Dash(__name__, use_pages=True, external_stylesheets=[dbc.themes.CYBORG])

    def run_thread(self, **kwargs):
        threading.Thread(target=self.dash.run_server, kwargs=kwargs, daemon=True).start()

    def run(self):
        self.dash.run(debug=True)
